package com.hzj.recipe.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;

/**
 * 评论表
 * @TableName comment
 */
@TableName(value ="comment")
@Data
public class Comment implements Serializable {
    /**
     * 评论id
     */
    @TableId(value = "comment_id")
    private Integer commentId;

    /**
     * 食谱id
     */
    @TableField(value = "recipe_id")
    private Integer recipeId;

    /**
     * 用户id
     */
    @TableField(value = "user_id")
    private Long userId;

    /**
     * 被评论的评论id
     */
    @TableField(value = "comment_parent_id")
    private Integer commentParentId;

    /**
     * 回复对象id，为null时代表回复评论，否则代表回复评论的评论
     */
    @TableField(value = "target_id")
    private Long targetId;

    /**
     * 文本
     */
    @TableField(value = "comment_content")
    private String commentContent;

    /**
     * 喜欢数
     */
    @TableField(value = "enjoy_num")
    private Integer enjoyNum;

    /**
     * 评论状态，0为未读，1为已读
     */
    @TableField(value = "comment_status")
    private Integer commentStatus;

    /**
     * 评论时间
     */
    @TableField(value = "create_time")
    private LocalDateTime createTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    //@Override
    //public boolean equals(Object that) {
    //    if (this == that) {
    //        return true;
    //    }
    //    if (that == null) {
    //        return false;
    //    }
    //    if (getClass() != that.getClass()) {
    //        return false;
    //    }
    //    Comment other = (Comment) that;
    //    return (this.getCommentId() == null ? other.getCommentId() == null : this.getCommentId().equals(other.getCommentId()))
    //        && (this.getRecipeId() == null ? other.getRecipeId() == null : this.getRecipeId().equals(other.getRecipeId()))
    //        && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
    //        && (this.getCommentParentId() == null ? other.getCommentParentId() == null : this.getCommentParentId().equals(other.getCommentParentId()))
    //        && (this.getTargetId() == null ? other.getTargetId() == null : this.getTargetId().equals(other.getTargetId()))
    //        && (this.getCommentContent() == null ? other.getCommentContent() == null : this.getCommentContent().equals(other.getCommentContent()))
    //        && (this.getEnjoyNum() == null ? other.getEnjoyNum() == null : this.getEnjoyNum().equals(other.getEnjoyNum()))
    //        && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
    //}
    //
    //@Override
    //public int hashCode() {
    //    final int prime = 31;
    //    int result = 1;
    //    result = prime * result + ((getCommentId() == null) ? 0 : getCommentId().hashCode());
    //    result = prime * result + ((getRecipeId() == null) ? 0 : getRecipeId().hashCode());
    //    result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
    //    result = prime * result + ((getCommentParentId() == null) ? 0 : getCommentParentId().hashCode());
    //    result = prime * result + ((getTargetId() == null) ? 0 : getTargetId().hashCode());
    //    result = prime * result + ((getCommentContent() == null) ? 0 : getCommentContent().hashCode());
    //    result = prime * result + ((getEnjoyNum() == null) ? 0 : getEnjoyNum().hashCode());
    //    result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
    //    return result;
    //}
    //
    //@Override
    //public String toString() {
    //    StringBuilder sb = new StringBuilder();
    //    sb.append(getClass().getSimpleName());
    //    sb.append(" [");
    //    sb.append("Hash = ").append(hashCode());
    //    sb.append(", commentId=").append(commentId);
    //    sb.append(", recipeId=").append(recipeId);
    //    sb.append(", userId=").append(userId);
    //    sb.append(", commentParentId=").append(commentParentId);
    //    sb.append(", targetId=").append(targetId);
    //    sb.append(", commentContent=").append(commentContent);
    //    sb.append(", enjoyNum=").append(enjoyNum);
    //    sb.append(", createTime=").append(createTime);
    //    sb.append(", serialVersionUID=").append(serialVersionUID);
    //    sb.append("]");
    //    return sb.toString();
    //}
}